package jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;

public class RegDemo {
    public static void main(String[] args) throws Exception {
        UserInfo userInfo=InputUtil.getInputObject(new UserInfo());
        System.out.println(userInfo);


//        Scanner scan=new Scanner(System.in);
//        System.out.println("输入用户名");
//        String user=scan.nextLine();
//        System.out.println("输入密码");
//        String  password= scan.nextLine();
//        System.out.println("输入昵称");
//        String nick=scan.nextLine();
//        System.out.println("输入年龄");
//        String age=scan.nextLine();
//        Class.forName("com.mysql.cj.jdbc.Driver");
//        Connection connection= DriverManager.getConnection(
//                "jdbc:mysql://localhost:3306/tedu?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true",
//                "root","200191");
//        System.out.println("与数据库建立链接！");
//        Statement statement=connection.createStatement();
//
//        String sql="INSERT INTO  userinfo(username,password,nickname,age) " +
//                "VALUES ('"+user+"','"+password+"','"+nick+"','"+age+"')";
//        int num= statement.executeUpdate(sql);
//        if (num>0){
//            System.out.println("注册成功");
//        }
//        connection.close();
    }
}
